﻿using System;

namespace Program4
{
    class Program4
    {
        static void Main(string[] args)
        {
            int[][] matrix = new int[3][];
            matrix[0] = new int[4] { 1, 2, 3, 4 };
            matrix[1] = new int[4] { 5, 1, 2, 3 };
            matrix[2] = new int[4] { 9, 5, 1, 2 };
            Console.WriteLine( isToeplitz(matrix));
        }
        static bool isToeplitz(int[][] m)
        {
            bool flag = true;
            int n2 = m[0].Length;
            int n1 = m.Length;
            for (int i = 0, j = 0; i < n1-1&& j < n2-1; j++)
            {
                if (m[i][j] != m[i + 1][j + 1])
                { flag = false; break; }
                if (j == n2 - 2) { i++; j = -1; }
            }
            return flag;
        }
    }
}
